#{extends '/template/main.html' /}
<script type="text/javascript" src="/public/js/echarts.min.js" ></script>
<div id="container" style="width:100%; height:700px;"></div>

<script type="text/javascript">
    var dom = document.getElementById("container");
    var myChart = echarts.init(dom);
    getType();
    function getType() {
        option = {
            xAxis: {
                type: 'category',
                data:(function(){
                    var arr2=[];
                    $.ajax({
                        type : "get",
                        async : false, //同步执行
                        url : "/BS0031/admin/report/getSaleStatisticsByDay",
                        success : function(data) {
                            console.log("data",data)
                            var mapsList = data.evDay;
                            if (data) {
                                for(var i=0;i<mapsList.length;i++){
                                    console.log(mapsList[i]);
                                    arr2.push(mapsList[i]);
                                }
                            }
                        },
                        error : function(errorMsg) {
                            alert("不好意思，图表请求数据失败啦!");
                            myChart.hideLoading();
                        }
                    })
                    return arr2;
                })()
            },
            yAxis: {
                type: 'value'
            },
            series: [{
                data: (function(){
                    var arr=[];
                    $.ajax({
                        type : "get",
                        async : false, //同步执行
                        url : "/BS0031/admin/report/getSaleStatisticsByDay",
                        success : function(data) {
                            console.log("data",data)
                            var mapsList = data.sumCount;
                            if (data) {
                                for(var i=0;i<mapsList.length;i++){
                                    console.log(mapsList[i]);
                                    arr.push(mapsList[i]);
                                }
                            }
                        },
                        error : function(errorMsg) {
                            alert("不好意思，图表请求数据失败啦!");
                            myChart.hideLoading();
                        }
                    })
                    return arr;
                })(),
                type: 'line'
            }]
        };
        myChart.setOption(option)
    }
</script>